package com.victor.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.victor.entity.Age;
import com.victor.entity.Praise;

@Mapper
public interface PraiseDao {
	
	Integer selPraise(Praise praise);
	
	@Insert({"insert into praise(uid,pid,flag,time) values(#{uid},#{pid},#{flag},#{time})"})
	int insPraise(Praise praise);
	
	@Select({"select count(*) from praise where pid=#{pid}"})
	Integer selPraiseByPid(int pid);
	
	@Select({"select * from praise where flag=1 AND uid=#{uid}"})
	List<Praise> selPraiseByFlag(int uid);
	
	@Update({"update praise set flag=0 where uid=#{uid} and pid=#{pid}"})
	boolean updPraise(int uid,int pid);
	
}